using System.Collections.Generic;
using OracleInternal.Common;
using OracleInternal.SqlAndPlsqlParser.LocalParsing;

namespace OracleInternal.SqlAndPlsqlParser.RuleProcessors.ODPCommands
{
	internal static class OracleMbEarleyLabeledBlockStmtRuleMultiProcessors
	{
		public static OracleMbEarleyRuleMultiProcessorAddItem[] s_vRuleProcessorItems;

		static OracleMbEarleyLabeledBlockStmtRuleMultiProcessors()
		{
			OracleMbEarleyRuleMultiProcessorAddItem[] array = new OracleMbEarleyRuleMultiProcessorAddItem[2];
			OracleMbEarleyRuleMultiProcessorAddItem oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "labeled_block_stmt",
				m_vRHSSymbols = new string[1]
				{
					"block_stmt"
				},
				m_vRuleProcessor = Process_LabeledBlockStmt_BlockStmt_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[0] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "labeled_block_stmt",
				m_vRHSSymbols = new string[2]
				{
					"label_list_opt",
					"block_stmt"
				},
				m_vRuleProcessor = Process_LabeledBlockStmt_LabelListOpt_BlockStmt_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[1] = oracleMbEarleyRuleMultiProcessorAddItem;
			s_vRuleProcessorItems = array;
		}

		public static object Process_LabeledBlockStmt_BlockStmt_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			OracleLpParserContext oracleLpParserContext = (OracleLpParserContext)ctx;
			OracleLpStatement result = (oracleLpParserContext.CurrentStatement = new OracleLpBlockStatement(oracleLpParserContext.CurrentStatementText, (IOracleMetadata)oracleLpParserContext.GetActiveObject(0)));
			OracleMbEarleyRuleMultiProcessorTable ruleProcessorTable = ctx.RuleProcessorTable;
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("block_stmt");
			OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(ctx.CurrentParseNode, ctx.CurrentRuleIndex + 1, -1, ctx);
			ctx.RuleProcessorTable = ruleProcessorTable;
			return result;
		}

		public static object Process_LabeledBlockStmt_LabelListOpt_BlockStmt_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			OracleLpParserContext oracleLpParserContext = (OracleLpParserContext)ctx;
			OracleLpStatement result = (oracleLpParserContext.CurrentStatement = new OracleLpBlockStatement(oracleLpParserContext.CurrentStatementText, (IOracleMetadata)oracleLpParserContext.GetActiveObject(0)));
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleMbEarleyRuleMultiProcessorTable ruleProcessorTable = ctx.RuleProcessorTable;
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("label_list_opt");
			OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[0], 0, -1, ctx);
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("block_stmt");
			OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[1], 0, -1, ctx);
			ctx.RuleProcessorTable = ruleProcessorTable;
			return result;
		}
	}
}
